<script lang="ts" setup>
import { ref } from 'vue'
import { bus } from '@/utils/mitt'
import { changeIdentityToUserAPI } from '@/api/userInfo'
import { ElMessage } from 'element-plus'
const dialogFormVisible = ref(false)
const userid = ref()
bus.on('deleteId', async (id: number) => {
  userid.value = id
})
const deleteAdmin = async () => {
  const res = await changeIdentityToUserAPI(userid.value)
  console.log(res)
}
// 打开删除的弹窗
const open = () => {
  dialogFormVisible.value = true
}
defineExpose({
  open
})
const emit = defineEmits(['success'])
</script>
<template>
  <el-dialog
    v-model="dialogFormVisible"
    title="降级操作"
    destroy-on-close
    width="600px"
    align-center
    draggable
  >
    <span>是否降级当前用户？降级后，当前用户会转到用户列表中！</span>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="deleteAdmin"> 确定 </el-button>
      </span>
    </template>
  </el-dialog>
</template>
<style lang="less" scoped></style>
